
#pragma once

#include <gl/glew.h>
#include <vector>
using namespace std;

#include "glm\glm.hpp"
#include "glm\ext.hpp"
using namespace glm;

#include "GlobalTypes.h"
#include "Nodes.h"
#include "ExecMeter.h"


class SceneGraph : public INode
{
	SINGLETON(SceneGraph);
public:
	virtual void render(render_params* params)
	{
		glClearColor(_clearColor.r, _clearColor.g, _clearColor.b, _clearColor.a);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		_renderParams.clear();
		
		INode::render(&_renderParams);
	}

	void init()
	{
		// basic draw configuration
		_clearColor.r = 0.0f;
		_clearColor.g = 0.0f;
		_clearColor.b = 0.0f;
		_clearColor.a = 1.0f;
		glClearColor(_clearColor.r, _clearColor.g, _clearColor.b, _clearColor.a);

		_clearDepth = 1.0f;
		glClearDepth(_clearDepth);
		glEnable(GL_DEPTH_TEST);
		glDepthFunc(GL_LESS);

		glEnable(GL_BLEND);
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		glEnable(GL_TEXTURE_2D);
	}

private:
	ColorRGBA _clearColor;
	GLclampd _clearDepth;
	render_params _renderParams;

	SceneGraph() {}
};